# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Document do
  @moduledoc """
  Defines the structure for content warehouse document proto.

  ## Attributes

  *   `cloudAiDocument` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudDocumentaiV1Document.t`, *default:* `nil`) - Document AI format to save the structured content, including OCR.
  *   `contentCategory` (*type:* `String.t`, *default:* `nil`) - Indicates the category (image, audio, video etc.) of the original content.
  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time when the document is created.
  *   `creator` (*type:* `String.t`, *default:* `nil`) - The user who creates the document.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Required. Display name of the document given by the user. This name will be displayed in the UI. Customer can populate this field with the name of the document. This differs from the 'title' field as 'title' is optional and stores the top heading in the document.
  *   `displayUri` (*type:* `String.t`, *default:* `nil`) - Uri to display the document, for example, in the UI.
  *   `dispositionTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. If linked to a Collection with RetentionPolicy, the date when the document becomes mutable.
  *   `documentSchemaName` (*type:* `String.t`, *default:* `nil`) - The Document schema name. Format: projects/{project_number}/locations/{location}/documentSchemas/{document_schema_id}.
  *   `inlineRawDocument` (*type:* `String.t`, *default:* `nil`) - Raw document content.
  *   `legalHold` (*type:* `boolean()`, *default:* `nil`) - Output only. Indicates if the document has a legal hold on it.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The resource name of the document. Format: projects/{project_number}/locations/{location}/documents/{document_id}. The name is ignored when creating a document.
  *   `plainText` (*type:* `String.t`, *default:* `nil`) - Other document format, such as PPTX, XLXS
  *   `properties` (*type:* `list(GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Property.t)`, *default:* `nil`) - List of values that are user supplied metadata.
  *   `rawDocumentFileType` (*type:* `String.t`, *default:* `nil`) - This is used when DocAI was not used to load the document and parsing/ extracting is needed for the inline_raw_document. For example, if inline_raw_document is the byte representation of a PDF file, then this should be set to: RAW_DOCUMENT_FILE_TYPE_PDF.
  *   `rawDocumentPath` (*type:* `String.t`, *default:* `nil`) - Raw document file in Cloud Storage path.
  *   `referenceId` (*type:* `String.t`, *default:* `nil`) - The reference ID set by customers. Must be unique per project and location.
  *   `textExtractionDisabled` (*type:* `boolean()`, *default:* `nil`) - If true, text extraction will not be performed.
  *   `textExtractionEnabled` (*type:* `boolean()`, *default:* `nil`) - If true, text extraction will be performed.
  *   `title` (*type:* `String.t`, *default:* `nil`) - Title that describes the document. This can be the top heading or text that describes the document.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The time when the document is last updated.
  *   `updater` (*type:* `String.t`, *default:* `nil`) - The user who lastly updates the document.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :cloudAiDocument =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudDocumentaiV1Document.t() | nil,
          :contentCategory => String.t() | nil,
          :createTime => DateTime.t() | nil,
          :creator => String.t() | nil,
          :displayName => String.t() | nil,
          :displayUri => String.t() | nil,
          :dispositionTime => DateTime.t() | nil,
          :documentSchemaName => String.t() | nil,
          :inlineRawDocument => String.t() | nil,
          :legalHold => boolean() | nil,
          :name => String.t() | nil,
          :plainText => String.t() | nil,
          :properties =>
            list(GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Property.t())
            | nil,
          :rawDocumentFileType => String.t() | nil,
          :rawDocumentPath => String.t() | nil,
          :referenceId => String.t() | nil,
          :textExtractionDisabled => boolean() | nil,
          :textExtractionEnabled => boolean() | nil,
          :title => String.t() | nil,
          :updateTime => DateTime.t() | nil,
          :updater => String.t() | nil
        }

  field(:cloudAiDocument, as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudDocumentaiV1Document)
  field(:contentCategory)
  field(:createTime, as: DateTime)
  field(:creator)
  field(:displayName)
  field(:displayUri)
  field(:dispositionTime, as: DateTime)
  field(:documentSchemaName)
  field(:inlineRawDocument)
  field(:legalHold)
  field(:name)
  field(:plainText)

  field(:properties,
    as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Property,
    type: :list
  )

  field(:rawDocumentFileType)
  field(:rawDocumentPath)
  field(:referenceId)
  field(:textExtractionDisabled)
  field(:textExtractionEnabled)
  field(:title)
  field(:updateTime, as: DateTime)
  field(:updater)
end

defimpl Poison.Decoder,
  for: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Document do
  def decode(value, options) do
    GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Document.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Document do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
